package com.slipper.system.common;

import com.slipper.common.permit.PermitAll;
import com.slipper.common.util.DateUtil;
import com.slipper.common.util.ResultUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@RestController
public class CommonController {
    @PostMapping("/refresh")
    public String refresh() {
        Constants.getCurrentUser();
        return ResultUtil.toSuccessJson("刷新成功！");
    }

    @PermitAll
    @PostMapping("/systemInfo")
    public String systemInfo() {
        Map<String, Object> data = new HashMap<>();
        data.put("currentDate", DateUtil.formatDate(new Date()));
        data.put("currentDatetime", DateUtil.formatTime(new Date()));
        return ResultUtil.toJson(data);
    }
}
